package top.csy8888.work3.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.csy8888.work3.entity.Product;
import top.csy8888.work3.service.ProductService;

/**
 * @author CSY
 * @date 2025 - 09 - 27
 */
@RestController
@RequestMapping("/api/v1")
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping("/user/{id}")
    public String getUserById(@PathVariable Integer id) {
        Product product = productService.getProductById(id);
        return product.toString();
    }
}
